package org.scirp.ijmis.dao.copyright.impl;

import java.util.List;

import org.scirp.ijmis.dao.base.impl.BaseDAOImpl;
import org.scirp.ijmis.dao.copyright.ICopyrightDAO;
import org.scirp.ijmis.po.copyright.Copyright;

public class CopyrightDAOImpl extends BaseDAOImpl<Copyright> implements ICopyrightDAO {

	private static final String className = CopyrightDAOImpl.class.toString();

	public List<Copyright> selectAll() {

		String hql = "from Copyright order by pid desc";
		return super.ExecuteQuery(hql, className + "-->selectAll");
	}

	public Copyright selectById(long id) {

		return (Copyright) super.selectById(id, className + "-->selectById");
	}

	public Copyright deleteCopyright(Copyright copyright) {
		return super.deleteObject(copyright, className + "-->deleteCopyright");
	}

	public long saveCopyright(Copyright copyright) {
		return saveObject(copyright, className + "-->saveCopyright");
	}

	public boolean updateCopyright(Copyright copyright) {
		return updateObject(copyright, className + "-->updateCopyright");
	}

	public Copyright selectByPaperId(long id) {

		String hql = "from Copyright where PAPERID=" + id;
		List<Copyright> list = super.ExecuteQuery(hql, className + "-->selectByPaperId");
		if (list.size() > 0)
			return list.get(0);
		else
			return null;
	}
}
